// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov  Date: 2007-9-15 18:54:35

// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   w3.java

package com.zelix;

import java.awt.Component;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;

// Referenced classes of package com.zelix:
//            v3, ic, zz, pz, 
//            wz, qz

public class w3 extends v3
    implements MouseListener, KeyListener, PropertyChangeListener, pz
{

    private File k;
    private File l[];
    private DefaultListModel m;
    private boolean n;
    private int o;
    private FileFilter p;
    boolean q;
    private static String z[];

    public w3(File file, boolean flag, int i, FileFilter filefilter)
    {
        super();

label0:
        {
            a(false);
            m = new DefaultListModel();
            setModel(m);
            p = filefilter;
            n = flag;
            if(flag)
            {
                setSelectionMode(2);
                if(qz.a == 0)
                    break label0;
            }
            setSelectionMode(0);
        }
        o = i;
        a(file);
        wz wz1 = new wz(this);
        addListSelectionListener(wz1);
        addMouseListener(this);
        addKeyListener(this);
    }

    static void a(w3 w3_1, ListSelectionEvent listselectionevent)
    {
        w3_1.a(listselectionevent);
    }

    public boolean b(String s)
    {
        File file = new File(k, s);
        boolean flag = file.mkdir();
        if(flag)
        {
            g();
            setSelectedValue(file, true);
            zz.b(this);
        }
        return flag;
    }

    public File d()
    {
        return k;
    }

    public File[] e()
    {
        Object aobj[] = getSelectedValues();
        File afile[] = new File[aobj.length];
        System.arraycopy(((Object) (aobj)), 0, afile, 0, aobj.length);
        return afile;
    }

    public void keyPressed(KeyEvent keyevent)
    {
label0:
        {
            if(keyevent.getKeyCode() != 10)
                break label0;
            Object aobj[] = getSelectedValues();
            if(aobj == null || aobj.length != 1)
                break label0;
            File file = (File)aobj[0];
            if(!file.isDirectory())
            {
                if(o != 1 && o != 3)
                    break label0;
                firePropertyChange(z[2], null, file);
                if(qz.a == 0)
                    break label0;
            }
            a(file);
            firePropertyChange(z[1], null, file);
        }
    }

    public void keyReleased(KeyEvent keyevent)
    {
    }

    public void keyTyped(KeyEvent keyevent)
    {
    }

    private void a(ListSelectionEvent listselectionevent)
    {
        int ai[];
        boolean flag;
        int i;
        int i1;
        i1 = qz.a;
        ai = getSelectedIndices();
        flag = false;
        q = true;
        for (i = 0; i < ai.length; i++) {
            int j = ai[i];
            File file = (File) m.get(j);
            switch (o) {
                default:
                    continue;

                case 1: // '\001'
                    if (file.isDirectory()) {
                        removeSelectionInterval(j, j);
                    } else {
                        flag = true;
                    }
                    break;
                case 2: // '\002'
                    if (!file.isDirectory()) {
                        removeSelectionInterval(j, j);
                    } else {
                        flag = true;
                    }
                    break;

                case 3:
                    flag = true;
                    break;
            }
        }
            q = false;
            if(flag)
                firePropertyChange(z[0], null, e());
    }

    public void mouseClicked(MouseEvent mouseevent)
    {
label0:
        {
            if(mouseevent.getClickCount() != 2)
                break label0;
            int i = locationToIndex(mouseevent.getPoint());
            if(i <= -1)
                break label0;
            File file = (File)m.get(i);
            if(file.isDirectory())
            {
                a(file);
                firePropertyChange(z[1], null, file);
                if(qz.a == 0)
                    break label0;
            }
            if(o == 1 || o == 3)
            {
                Object aobj[] = getSelectedValues();
                if(aobj != null && aobj.length == 1)
                    firePropertyChange(z[2], null, file);
            }
        }
    }

    public void mouseEntered(MouseEvent mouseevent)
    {
    }

    public void mouseExited(MouseEvent mouseevent)
    {
    }

    public void mousePressed(MouseEvent mouseevent)
    {
    }

    public void mouseReleased(MouseEvent mouseevent)
    {
    }

    public void f()
    {
        if(k != null)
        {
            File file = k.getParentFile();
            if(file != null)
            {
                a(file);
                firePropertyChange(z[1], null, file);
            }
        }
    }

    public void propertyChange(PropertyChangeEvent propertychangeevent)
    {
label0:
        {
            int i = qz.a;
            if(propertychangeevent.getPropertyName().equals(z[1]))
            {
                File file = (File)propertychangeevent.getNewValue();
                a(file);
                if(i == 0)
                    break label0;
            }
            if(propertychangeevent.getPropertyName().equals(z[3]))
            {
                a((FileFilter)propertychangeevent.getNewValue());
                if(i == 0)
                    break label0;
            }
            if(propertychangeevent.getPropertyName().equals(z[2]))
                firePropertyChange(z[2], null, propertychangeevent.getNewValue());
        }
    }

    private void g()
    {
        DefaultListModel defaultlistmodel;
        int i;
        int j;
label0:
        {
            j = qz.a;
            if(p != null)
            {
                l = k.listFiles(p);
                if(j == 0)
                    break label0;
            }
            l = k.listFiles();
        }
        ic ic1 = ic.a();
        Arrays.sort(l, ic1);
        defaultlistmodel = new DefaultListModel();
        for(i = 0;i<l.length;i++){
            defaultlistmodel.addElement(l[i]);
        }
            m = defaultlistmodel;
            setModel(defaultlistmodel);
    }

    public void a(FileFilter filefilter)
    {
        Object aobj[];
        ArrayList arraylist;
        int i;
        int j1;
        j1 = qz.a;
        if(p != filefilter){

        p = filefilter;
        aobj = getSelectedValues();
        g();
        arraylist = new ArrayList(aobj.length);
        for(i = 0;i<aobj.length;i++){
        int j = m.indexOf(aobj[i]);
        if(j > -1)
            arraylist.add(new Integer(j));
        }
        int ai[];
        int i1;
        ai = new int[arraylist.size()];
        for(i1 = 0;i1<arraylist.size();i1++){
        ai[i1] = ((Integer)arraylist.get(i1)).intValue();
        }
        setSelectedIndices(ai);
        if(ai.length > 0)
            ensureIndexIsVisible(ai[0]);
        }
    }

    public void a(File file)
    {
        if(k == null || !k.equals(file))
        {
            k = file;
            g();
            if(m.getSize() > 0)
                ensureIndexIsVisible(0);
        }
    }

    public void a(File file, boolean flag)
    {
        if(file != null && m.contains(file))
            setSelectedValue(file, flag);
    }

    private static String z(char ac[]) {
        for (int i = 0; i < ac.length; i++) {
            byte key = 0;
            switch (i % 5) {
                case 0:
                    key =0x6c;
                    break;
                case 1:
                    key =2;
                    break;
                case 2:
                    key =29;
                    break;
                case 3:
                    key =75;
                    break;
                default:
                    key =17;
                    break;
            }
            ac[i] ^= key;
        }
        return new String(ac).intern();
    }

    static 
    {
        String as[];
        as = new String[4];
        as[0] = "\037gq.r\030kr%R\004cs,t\b";
        as[1] = "\bko.r\030mo2R\004cs,t\b";
        as[2] = "\nks*}?gq.r\030kr%";
        as[3] = "\nkq.W\005ni.c/j|%v\tf";
        for (int i = 0; i < as.length; i++) {
            as[i] = z(as[i].toCharArray());
        }
        z = as;
    }
}